home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20000114-20000217 / 000069_news@columbia.edu _Tue Jan 18 16:26:08 2000.msg < prev    next >
Internet Message Format  |  2020-01-01  |  5KB

  1. Return-Path: <news@columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id QAA08195
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Tue, 18 Jan 2000 16:26:08 -0500 (EST)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id QAA28515
  7.     for kermit.misc@watsun.cc.columbia.edu; Tue, 18 Jan 2000 16:24:39 -0500 (EST)
  8. X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
  9. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  10. Subject: Case Study #11: C-Kermit Meets SSH
  11. Date: 18 Jan 2000 21:24:36 GMT
  12. Organization: Columbia University
  13. Message-ID: <862lmk$rr1$1@newsmaster.cc.columbia.edu>
  14. To: kermit.misc@columbia.edu
  15.  
  16.  
  17. One of the most frequent feature requests for Kermit software in recent
  18. years has been for SSH (Secure SHell) connections.  Although other security
  19. methods including Kerberos, SRP, and SSL/TLS are available in C-Kermit 7.0,
  20. we have not been able to add SSH, primarily for licensing and patent reasons.
  21.  
  22. But with the UNIX version of C-Kermit 7.0 you can make SSH connections
  23. anyway.  This gives you C-Kermit's file transfer, character-set translation,
  24. and scripting capabilities on an SSH connection.
  25.  
  26. The key is C-Kermit's new PTY command.  Pty (pronounced "pity") is the
  27. common abbreviation for "pseudoterminal".  A pseudoterminal is a virtual
  28. (simulated) device that has the characteristics of a real terminal; a Pty is
  29. used by UNIX as your controlling terminal when you come in via Telnet,
  30. Rlogin, SSH, or other "virtual" means, rather than through a serial port
  31. with its "real" terminal driver.  The Pty driver mimics what the real
  32. terminal driver does on a real terminal.
  33.  
  34. Ptys are also used by programs like 'expect' that run and interact with
  35. other programs.  Ptys are used for this rather than simple standard i/o
  36. redirection because (a) not all programs use standard i/o; (b) many programs
  37. behave differently when their standard i/o is not a terminal; and (c)
  38. redirected standard i/o has no associated terminal driver.
  39.  
  40. Unfortunately the application programming interface (API) for using Ptys is
  41. not standardized across Unix versions (let alone between Unix and other
  42. operating-system families), so each platform requires custom code.  We were
  43. able to add Pty control to C-Kermit 7.0 for the following platforms:
  44.  
  45.  . 4.4BSD, including BSDI/OS, NetBSD, FreeBSD, OpenBSD, Mac OS X
  46.  . DG/UX 5.4R4.11
  47.  . Digital UNIX 3.2 and Tru64 UNIX 4.0
  48.  . HP-UX 9.00 and later
  49.  . IBM AIX 4.1 and later
  50.  . IRIX 6.0 and later
  51.  . Linux
  52.  . NeXTSTEP 3.x
  53.  . QNX 4.25
  54.  . SCO OSR5.0.5
  55.  . SCO Unixware 7
  56.  . SINIX 5.42
  57.  . Solaris 2.x and 7
  58.  . SunOS 4.1.3
  59.  
  60. It can be added for others too but some degree of work would be required
  61. in each case -- maybe a little, maybe a lot.
  62.  
  63. The Pty interface has many uses.  Today we'll talk about SSH since so many
  64. people ask about it.  Let's begin by making an interactive SSH connection,
  65. just as you would with the regular SSH client:
  66.  
  67.   ssh xyzcorp.com
  68.  
  69. To do this with C-Kermit, simply prefix the command above with "pty" and
  70. give it at the C-Kermit> prompt:
  71.  
  72.   C-Kermit> pty ssh xyzcorp.com
  73.  
  74. You can escape back to C-Kermit and re-CONNECT in the normal way, but
  75. remember that the SSH client is active too; Newline (Return or Enter key)
  76. followed by tilde (~) is the SSH escape sequence, which you can read about
  77. in "man ssh".
  78.  
  79. Once you have a terminal connection, can it be used to transfer files?  Yes,
  80. but first you'll need disable control-character unprefixing because the Pty
  81. driver can "do things" to control characters (and also to prevent sending
  82. the SSH escape sequence in a packet).  Luckily, Kermit protocol is
  83. well-suited to such interference.  Before initiating a file transfer, just
  84. tell the file sender to:
  85.  
  86.   set prefixing all
  87.  
  88. That should be all you need (in fact, you don't have to prefix EVERY control
  89. character, but the fine tuning is up to you).  Assuming you have fast Kermit
  90. protocol settings (which C-Kermit 7.0 uses by default), performance is
  91. limited by network and/or the underlying pty driver -- some are fast, some
  92. aren't.
  93.  
  94. Scripting SSH connections is easy too.  As you might recall, a Kermit
  95. script uses SET HOST instead of TELNET and it uses INPUT and OUTPUT
  96. commands in place of CONNECT and your eyes and fingers.  The PTY command is
  97. like the TELNET command; it makes the connection and then goes into CONNECT
  98. (online interactive terminal) mode.  To open an SSH connection without
  99. entering CONNECT mode, use:
  100.  
  101.   set host /pty ssh xyzcorp.com
  102.  
  103. and then write the rest of your script in the normal manner, except with
  104. caution regarding the ssh client's escape sequence.  Note the new /PTY
  105. switch on the SET HOST command; type "set host ?" at the C-Kermit> prompt
  106. to see other new switches, and "help set host" to learn more about them.
  107.  
  108. For complete details on C-Kermit 7.0's Pty interface, read Section 2.7 of
  109. ckermit2.txt.  For more about why SSH is not included directly in C-Kermit,
  110. see:
  111.  
  112.   http://www.columbia.edu/kermit/ckfaq.html#ssh
  113.  
  114. If you're a programmer and want to add Pty support for a platform not listed
  115. above, let me know.
  116.  
  117. Finally, here's an exercise for the interested reader: rewrite this article
  118. under the new title, "C-Kermit Meets Tn3270".
  119.  
  120. - Frank